
local indata LAD\Data
local infile LAD\Data_Cleaning

use "`indata'\LAD_Crowdout.dta", clear

do "`infile'\LAD_Commands_filtering.do"

*Focus on savers within the relevant bandwidth
keep if empinc>=-6000 & empinc<6000

*Non-Unionized RPP Non-Members do not satisfy the Test of Running Variable and are excluded
keep if dues>0
*Focus on savers with strictly positive RRSP contributions
keep if rspcont>0
keep if rspcont<rspdlc & (penadjl+rspcont)<contlimit

local covars age agesq female married province_* selfempinc_flag eiinc_flag othinc disab medexp

*Generate the relevant interaction variables for the DD
gen treated=(penadj>0)
foreach x of varlist empinc empinc_kink `covars' {
	gen treated_`x'=treated*`x'
}

qui reg penadj empinc empinc_kink `covars' treated_* if treated==1
est store rppreg
qui reg rspcont empinc empinc_kink treated `covars' treated_*
est store savreg
suest savreg rppreg, cl(id)
nlcom (ratio: [savreg_mean]_b[treated_empinc_kink]/[rppreg_mean]_b[empinc_kink]), post
test _b[ratio]=-1

*Report the control group regression
reg rspcont empinc empinc_kink empinc_kink `covars' if treated==0

exit
